import os
# 高级的 文件、文件夹、压缩包 处理模块
import shutil
import time

path = 'C:/Users/Administrator/Desktop'

def scan_file():
    files = os.listdir(path)
    for f in files:
        if f.endswith('.zip'):
            return f

def unzip_it(f):
    folder_name = f.split('.')[0]
    target_path = path + '/' + folder_name
    shutil.unpack_archive(path + '/' + f, extract_dir=target_path)

def delete(f):
    os.remove(f)

while True:
    zip_file = scan_file()
    if zip_file:
        unzip_it(zip_file)
        delete(path + '/' + zip_file)
    time.sleep(1)
